package com.cictec.middleware.gps.engine.position.handler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cictec.middleware.core.entity.BusDriverSignIn;
import com.cictec.middleware.gps.engine.BusInstance;
import com.cictec.middleware.gps.engine.exception.BusPositionHandlerException;
import com.cictec.middleware.gps.engine.position.BusPositionHandler;
import com.cictec.middleware.gps.service.BusDriverService;

/**
 * 司机处理
 * 
 * @author Administrator
 *
 */
@Component
public class BusPositionDriverHandler  implements BusPositionHandler {

	@Autowired
	private BusDriverService busDriverService;
	@Override
	public void onHandler(BusInstance busInstance) throws BusPositionHandlerException {
		// TODO Auto-generated method stub
		
		// 司机签到信息处理
		BusDriverSignIn busDriverSignIn = busDriverService.getSignDriver(busInstance.getBusUuid(), busInstance.getTime());
		if(null != busDriverSignIn){
			busInstance.setDriverUuid(busDriverSignIn.getSignDrvUuid());
			busInstance.setDriverName(busDriverSignIn.getDrvName());
			busInstance.setDriverIccard(busDriverSignIn.getSignCardId());
		}else{
			busInstance.setDriverUuid("");
			busInstance.setDriverName("");
			busInstance.setDriverIccard("");
		}
		
	}

}
